home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
- CALC.TPU (2.0) TP5.X Compiled Unit CALC.TPU (2.0)
-
-
-
- UNIT NAME
-
- CALC.TPU - Version 1.0 for Turbo Pascal Version 5.X.
-
- Version 1.0 Released July 30, 1988.
- Version 1.1 Released Aug. 15, 1988, corrects window removal.
- Version 2.0 Released Dec. 27, 1988. TP5.X and TP4 compatible.
-
-
- PROGRAMMER
-
-
- Timothy B. Coleman
- 11115 Kenmoor Drive
- Detroit, Michigan 48205
-
-
-
- GENERAL DESCRIPTION
-
-
- This Unit file will allow a Turbo Pascal Ver. 5.X (TP5.X)
- programmer to add a Four Function Calculator to any TP5.X
- program with the declaration, "Uses Calc, Meta;". CALC.TPU
- contains the calculator "engine" to perform a perfect
- emulation of a handheld four function calculator. The unit
- can make the result of a calculation available, for
- insertion into the application below the calculator window.
- Meta is a unit that contains the Metaphor or image of a
- calculator.
-
- Three example calculator Metaphor tpu files and the source
- code are included, or the developer may create its META.TPU,
- using one of the included files as an example. The
- programmer then decides whether or not a calculator
- metaphor, key help screen, or simply a small window, where
- only the numbers entered and results are displayed, is
- appropriate for the given application. Or the programmer
- may decide to give the user a choice of a small window or a
- metaphor in the programs installation procedures.
-
- The programmer can elect to use the unit in its default form
-
-
-
-
- -1-
-
-
-
-
-
- CALC.TPU (2.0) TP5.X Compiled Unit CALC.TPU (2.0)
-
-
- by binding it to a key and calling the procedure
- "Calculator", in much the same way a help screen might be
- called.
-
- The CALC.TPU defaults are:
-
- * Do not wait for retrace.
- * Window border color is white (15).
- * Calculator display is white.
- * Keyboard number lock is set on.
-
- When calling the calculator, the current screen (CGA, MONO,
- EGA, VGA, MCGA, 80 column text mode only) is saved and a
- window is opened displaying whatever the developer decides
- the installed calculator should look.
-
- OPERATION
-
- The window can be moved across the screen in five
- character-cell steps, to allow any on screen values to be
- seen from the application below. The normal numeric keys
- and +, -, /, and * perform the normal four functions, and
- the c, e =, or <enter> provide Clear all, clear Entry, and
- total functions. The right and left arrow keys move the
- calculator window on the screen. On the enhanced keyboard,
- the cursor pad will allways be "on", but on the older
- keyboard the cursor and numeric functions are shared. If
- EnhncdKeyboard is set to FALSE, then the user will
- automatically have the number pad turned on. The shift key
- must then be pressed to use the right and left arrow keys to
- move the calculator across the screen.
-
- The user may return to the application by hitting the escape
- key. When the calculator is called upon for later use, the
- last calculation is still intact and it returns to the on
- screen position last set by the user. The programmer may
- write code (see the example in SAMPLE.PAS) to utilize the
- value placed in the variable "PasteValue", when the exit is
- performed by the F10 key from within the calculator.
-
- FLEXIBILITY
-
-
-
-
- -2-
-
-
-
-
-
- CALC.TPU (2.0) TP5.X Compiled Unit CALC.TPU (2.0)
-
-
- By managing its own window, CALC.TPU frees the programmer
- from additional interface requirements. Developers wanting
- to control window management must purchase the source code.
-
- Screen colors, number pad control, and "wait for retrace"
- may be set by the programmer, or by the user if the
- programmer has a general installation procedure. The
- calculator has an exit flag (PasteExit : Boolean;) to allow
- the programmer to determine if the users exit requires a
- value (PasteValue : String) be pasted into the application.
-
- By purchasing the source code, changes can be made in the
- code to allow its use across networks, utilize a numeric
- coprocessor, or it may be modified for use in XENIX
- applications using one of the PASCAL compilers available for
- that Operating system (I read somewhere that BORLAND may
- port its languages to XENIX or UNIX and that OS2 versions
- were coming soon).
-
-
- LICENSE REQUIREMENTS
-
- CALC.TPU UNIT LICENSE
-
- A developer wishing to compile the unit, CALC.TPU, into an
- application may do so by completing the License application
- in this ARC file and returning it with a Check or Money
- order for Twenty Dollars ($20.00). The developer may use the
- unit, CALC.TPU in any number of applications for private or
- commercial use. There are no royalties or other fees for
- the use of the unit CALC.TPU in an application. CALC.TPU
- may not be distributed with any other software unless in the
- form of the full ARC file, with all sample files, CALC.TPU,
- META files, license form, and this documentation file
- present.
-
- CALC.PAS SOUCRE CODE LICENSE
-
- The source code to CALC.TPU may also be purchased for Sixty
- dollars ($60.00). The license form must be completed and
-
-
-
-
- -3-
-
-
-
-
-
- CALC.TPU (2.0) TP5.X Compiled Unit CALC.TPU (2.0)
-
-
- returned along with a check or money order for Sixty dollars
- ($60.00). When purchasing the source do not send any
- additional for the TPU. The source license includes the
- TPU. Purchasing the source code allows one to add other
- features such as memory variable keys, percent key
- operation, number base conversion, paper tape printing to
- file, printer or screen, slide rule functions, and other
- features. The source will be delivered on 5 1/4", 360K, IBM
- compatible floppy or on 3 1/2", 720K, IBM compatible floppy,
- or on both for an additional $3.00. Also included with the
- media is a fully commented source listing with cross
- reference for all label, constants, types, variables,
- procedures, and functions.
-
- Also available in source code form is the same calculator as
- an include file for Turbo Pascal Version 3 (TP3). This
- include file adds approx. 5k to an executable TP3 program.
- The cost of this file is Sixty dollars ($60.00).
-
- The source code to CALC.TPU, and the TP3 version, CALC.INC,
- remains the property of Timothy B. Coleman and may not be
- distributed in printed or electronic form, or on magenetic
- media, or any other media. It is the responsibility of the
- programmer using this source code to respect its proprietary
- nature.
-
- Upon receipt of your license application, a registration
- form, and source code for those requesting it, will be
- mailed within two days.
-
- The META files, both source and TPU, are available with the
- SHAREWARE release of CALC.TPU, and may be modified freely.
-
- Following the simple methodology used by the calculator, a
- programmer may add many additional functions suitable for
- the specific application being designed. Purchasing the
- source will also allow simple recoding to support terminals
- and network applications.
-
-
- INTERFACE
-
-
-
-
- -4-
-
-
-
-
-
- CALC.TPU (2.0) TP5.X Compiled Unit CALC.TPU (2.0)
-
-
- The unit file has the following interface:
-
- Uses
- Crt,
- meta,
- cursors,
- fastWr;
- Procedure Calculator;
- Var PasteValue : String;
- {Contains the result of a calculation.}
-
- PasteExit : Boolean;
- {Flag indicating the result should be pasted.}
- KillSnow : Boolean;
- {If set to TRUE screen writes wait for retrace.}
- BoxTint : Integer;
- {Color of the window border.}
- ValueTint : Integer;
- {Color of number written to the display}
- EnhncdKeyboard : Boolean;
- {If set to TRUE number locks not turned on.}
-
- Unit name: CALC
- Total code: 3495
- Initialized data: 72
- Uninitialized data: 5594
- Symbol table: 773
- Relocation table: 3168
- Line number table: 0
- Numeric processing: $N-
-
-
- ACKNOWLEDGEMENTS
-
- The sometimes unpredictable and inconsistent operation of
- the TP5 Write and Writeln procedures, led me to the decision
- to utilize Brian Foley's SUPER! Public Domain procedure,
- FASTWR.TPU. This file (FASTWR.ARC) is available on
- CompuServe in the Borland Library (GO BOR-100, LIB 2).
-
-
-
-
- -5-
-
-
-
-
-
- CALC.TPU (2.0) TP5.X Compiled Unit CALC.TPU (2.0)
-
-
- FASTWR is used to draw the window and to display entered
- values and results on the screen. FASTWR writes to the crt
- much faster than TP5.X's own Write and it allows positioning
- and color selection in one command. I also used FASTWR in
- the META file for the calculator image or metaphor. I
- suggest the use of FASTWR.TPU in any programmer created META
- file, but other routines should work fine. If you cannot
- find FASTWR.ARC or did not get this file from CompuServe,
- include a note, when you mail your license form, requesting
- a copy and I'll send it with your Registration form.
-
- Also utilized, is the Public Domain routines in CURSORS.TPU
- by Scott Bussinger, Professional Practice Systems, ver.
- 1.02. CURSORS.TPU is used in CALC.TPU to blank the cursor
- during calculator use, and to retore it and its original
- position after use.
-
- Thanks to Brian Foley and Scott Bussinger for writing those
- fine routines.
-
-
- APPLICATIONS
-
- Now that TP allows the executable program to be up 640K, it
- is easy to build a friendlier, more complete application.
- The addition of a calculator may at first thought seem to be
- rather a rudimentary improvement. With cheap four function
- calculators costing about five bucks ($5.00), why worry
- about adding one to an application? Probably the best
- justification is that a user cannot paste the result of a
- calculation from a handheld unit into the application on
- screen. The possibility of making an error in transfering
- the number is eliminated. Popup windows have proven to be a
- popular way of presenting information, and a useful way of
- doing something else while in the context of a prior task.
- Many applications can benefit from the addition of this
- professional appearing, windowed calculator. The changes
- can be made to most TP5.X programs in 5 to 15 minutes! Here
- are some example applications:
-
- * Point of sale software.
- * Payroll Programs
-
-
-
-
-
- -6-
-
-
-
-
-
- CALC.TPU (2.0) TP5.X Compiled Unit CALC.TPU (2.0)
-
-
-
- * Accounting Packages.
- * DataBase management software.
- * Word Processing software.
- * Text Editors.
- * Communication Software.
- * SpreadSheet programs.
- * Project management Software.
- * Desktop management applications.
- * Integrated Software (call from any part of the program).
-
- Remember also that while TSR programs, along with
- sophisticated environments such as MicroSoft Windows, all
- provide built in calculators, these programs can use vast
- amounts of memory and may not work smoothly with your
- application. It has also been stated that TSR programs
- should not be used in the Compatibility Box under OS2. TSR
- programs also do not work well in environments like
- PC-MOS/386. It is therefore more important that your new
- application include proven, useful desktop applications such
- as CALC.TPU.
-
- FILES
-
- Files included in the ARC file are listed below:
-
- CALC TPU - The calculator unit.
- CALC DOC - This documentation file.
- META1 PAS - A metaphor of a large handheld calculator.
- META1 TPU - The compiled unit.
- META2 TPU - The metaphor of a small handheld calculator.
- META2 PAS - The compiled unit.
- META3 TPU - A tiny window at the top of the screen.
- META3 PAS - The compiled unit.
- READ ME - Read this file FIRST.
- SAMPLE EXE - A sample program demonstarting all Features
- SAMPLE PAS - Source for the sample executable.
- LICENSE FRM - The license form to be printed and mailed.
- PRINTDOC BAT - A batch file to print this file and the
- license.
- All source code is completely commented to insure that you
- can implement CALC.TPU into your application in MINUTES!!
-
-
-
-
-
- -7-
-
-
-
-
- CALC.TPU (2.0) TP5.X Compiled Unit CALC.TPU (2.0)
-
-
- COMPILING
-
- To compile CALC.TPU into an application, you must rename one
- of the meta files from meta1, meta2, or meta3, to meta. If
- you are compiling one of the meta source files you must have
- FASTWR.TPU (or recode to support your choice of display
- routines.) where the compiler can locate it, along with
- CALC.TPU. Read the file SAMPLE.PAS to see how things are
- coded.
-
- The keyboard buffer is the perfect place to send alpha
- numeric charcters from the calculator. One method of doing
- this is listed below:
-
- PROCEDURE BufIn(PushInt : Integer);
- BEGIN
- INLINE
- ($1E/
- $B8/$40/$00/
- $8E/$D8/
- $FA/
- $8B/$46/$04/
- $8B/$1E/$1C/$00/
- $89/$07/
- $83/$C3/$02/
- $3B/$1E/$82/$00/
- $79/$07/
- $89/$1E/$1C/$00/
- $EB/$09/$90/
- $8B/$1E/$80/$00/
- $89/$1E/$1C/$00/
- $FB/
- $1F);
- END;
-
- This code was captured from a Borland forum discussion and I
- cannot remember whom to credit.
-
- FOR index := 1 to Length(LastOper) DO
- BEGIN
- PushInt := Integer(PasteValue[index]);
- BufIn(PushInt);
- END;
-
- The code fragment above is used to stuff characters one at a
- time, into the keyboard routine, BufIn. One other simple
- method of stuffing the buffer is given in the file KBD.ARC
- on CompuServe's Borland SIG in LIB 2. Any number of methods
- may be used to put the result of a calculation into your
-
-
-
- -8-
-
-
-
-
-
- CALC.TPU (2.0) TP5.X Compiled Unit CALC.TPU (2.0)
-
-
- application.
-
- After reading the file SAMPLE.PAS, you may want to change
- the colors, set the variable, enhncdkeyboard, for your type
- of keyboard, and rename one of the meta files and recompile
- to see first hand how easy it is to make the calculator look
- any way you wish.
-
-
- HISTORY
-
- CALC.TPU was originally a procedure I wrote for a custom
- Database mgmt. and billing system I was designing, for a
- market that shall remain unnamed since I have don't
- presently have any competition. It worked so well that I
- decided to convert it to a stand-alone TP3 program and make
- it PUBLIC DOMAIN. Within months, I had moved it into a TSR
- calculator (also PUBLIC DOMAIN). Both went through several
- revisions and with user feedback, small bugs were identified
- and eliminated. Enhancments were added with every release.
- Both programs are still available on CompuServe's IBMSW
- software forum in LIB 12. The programs are FFC45.ARC and
- FFNC74.ARC.
-
- What I have delivered to you in CALC.TPU ver. 1.0 is not a
- beta file, but a completely debugged, enhanced product,
- tested by thousands of users. During the past two years, I
- have received countless letters, and Email regarding the
- calculator in either TSR or stand alone form. This response
- makes believe any application utilizing CALC.TPU can only be
- improved by its presence. Try comparing its output to your
- own four function calculator.
-
-
- WARNINGS
-
- The use of TP's floating point emulator has a range of 2.9
- X 10E-39 to 1.7 X 10E38, and 11 to 12 significant digits.
- While code has been added to prevent divide by zero errors,
- it is possible for a user to continually increment a value
- with multiplication to the point of forcing an overflow.
- This is not a serious event if you use a critical error
- handler to intercept errors in a controlled manner. When an
-
-
-
-
- -9-
-
-
-
-
-
-
-
- CALC.TPU (2.0) TP5.X Compiled Unit CALC.TPU (2.0)
-
-
- error occurs, the critical handler can take over and
- promoptly close all open files and allow an orderly shut
- down. Under these circumstances, the user should be able to
- restart with no loss of current data. Code is available on
- CompuServe in the Borland SIG (LIB 1) from a back issue of
- Turbo Technix Magazine that provides excellent code
- fragments from which a programmer can build a useful error
- handler to suit the application.
-
-
- Mail license forms and fee to:
-
-
- Timothy B. Coleman
- 11115 Kenmoor Drive
- Detroit, Michigan 48205
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -10-
-
- ----------------end-of-author's-documentation---------------
-
- Software Library Information:
-
- This disk copy provided as a service of
-
- The Public (Software) Library
-
- We are not the authors of this program, nor are we associated
- with the author in any way other than as a distributor of the
- program in accordance with the author's terms of distribution.
-
- Please direct shareware payments and specific questions about
- this program to the author of the program, whose name appears
- elsewhere in this documentation. If you have trouble getting
- in touch with the author, we will do whatever we can to help
- you with your questions. All programs have been tested and do
- run. To report problems, please use the form that is in the
- file PROBLEM.DOC on many of our disks or in other written for-
- mat with screen printouts, if possible. The P(s)L cannot de-
- bug programs over the telephone.
-
- Disks in the P(s)L are updated monthly, so if you did not get
- this disk directly from the P(s)L, you should be aware that
- the files in this set may no longer be the current versions.
-
- For a copy of the latest monthly software library newsletter
- and a list of the 2,000+ disks in the library, call or write
-
- The Public (Software) Library
- P.O.Box 35705 - F
- Houston, TX 77235-5705
- Orders: 800-2424-PSL
- Info: 713-524-6394
- FAX #: 713-524-6398
- CIS ID: 71355,470
-